// 1.导入Vue和VueRouter的包
import Vue from 'vue'
import VueRouter from 'vue-router'

//导入需要的组件
// import Home from '@/views/Home/home.vue'
const Home = () => import( /* webpackChunkName: "Home_Order_Serach */ '@/views/Home/home.vue')
// import Order from '@/views/Order/order.vue'
const Order = () => import( /* webpackChunkName: "Home_Order_Serach */ '@/views/Order/order.vue')
// import Serach from '@/views/Serach/search.vue'
const Serach = () => import( /* webpackChunkName: "Home_Order_Serach */ '@/views/Serach/search.vue')

// import User from '@/views/User/user.vue'
const User = () => import( /* webpackChunkName: "User_Login_Food */ '@/views/User/user.vue')
// import Login from '@/views/User/Login/login.vue'
const Login = () => import( /* webpackChunkName: "User_Login_Food */ '@/views/User/Login/login.vue')
// import Food from '@/views/Food/food.vue'
const Food = () => import( /* webpackChunkName: "User_Login_Food */ '@/views/Food/food.vue')

// import Details from '@/views/Details/Details.vue'
const Details = () => import( /* webpackChunkName: "Details_DetailsShang_shopSafe */ '@/views/Details/Details.vue')
// import DetailsShang from '@/views/Details/DetailsShang/DetailsShang.vue'
const DetailsShang = () => import( /* webpackChunkName: "Details_DetailsShang_shopSafe */ '@/views/Details/DetailsShang/DetailsShang.vue')
// import shopSafe from '@/views/Details/shopSafe/shopSafe.vue'
const shopSafe = () => import( /* webpackChunkName: "Details_DetailsShang_shopSafe */ '@/views/Details/shopSafe/shopSafe.vue')

// import FoodDetails from '@/views/Details/FoodDetails/FoodDetails.vue'
const FoodDetails = () => import( /* webpackChunkName: "FoodDetails_confirmOrder_chooseAddress */ '@/views/Details/FoodDetails/FoodDetails.vue')
// import confirmOrder from '@/views/confirmOrder/confirmOrder.vue'
const confirmOrder = () => import( /* webpackChunkName: "FoodDetails_confirmOrder_chooseAddress */ '@/views/confirmOrder/confirmOrder.vue')
// import chooseAddress from '@/views/confirmOrder/chooseAddress/chooseAddress.vue'
const chooseAddress = () => import( /* webpackChunkName: "FoodDetails_confirmOrder_chooseAddress */ '@/views/confirmOrder/chooseAddress/chooseAddress.vue')

// import remark from '@/views/confirmOrder/remark/remark.vue'
const remark = () => import( /* webpackChunkName: "remark_invoice_info */ '@/views/confirmOrder/remark/remark.vue')
// import invoice from '@/views/confirmOrder/invoice/invoice.vue'
const invoice = () => import( /* webpackChunkName: "remark_invoice_info */ '@/views/confirmOrder/invoice/invoice.vue')
// import info from '@/views/User/info/info.vue'
const info = () => import( /* webpackChunkName: "remark_invoice_info */ '@/views/User/info/info.vue')

// import setusername from '@/views/User/info/setusername/setusername.vue'
const setusername = () => import( /* webpackChunkName: "setusername_address_add */ '@/views/User/info/setusername/setusername.vue')
// import address from '@/views/User/info/address/address.vue'
const address = () => import( /* webpackChunkName: "address_address_address */ '@/views/User/info/address/address.vue')
// import add from '@/views/User/info/address/add/add.vue'
const add = () => import( /* webpackChunkName: "address_address_address */ '@/views/User/info/address/add/add.vue')

// import addDetail from '@/views/User/info/address/addDetail/addDetail.vue'
const addDetail = () => import( /* webpackChunkName: "addDetail_forget_balance */ '@/views/User/info/address/addDetail/addDetail.vue')
// import forget from '@/views/User/forget/forget.vue'
const forget = () => import( /* webpackChunkName: "addDetail_forget_balance */ '@/views/User/forget/forget.vue')
// import balance from '@/views/User/balance/balance.vue'
const balance = () => import( /* webpackChunkName: "addDetail_forget_balance */ '@/views/User/balance/balance.vue')

// import detail from '@/views/User/balance/detail/detail.vue'
const detail = () => import( /* webpackChunkName: "detail_benefit_hbHistory*/ '@/views/User/balance/detail/detail.vue')
// import benefit from '@/views/User/benefit/benefit.vue'
const benefit = () => import( /* webpackChunkName: "detail_benefit_hbHistory*/ '@/views/User/benefit/benefit.vue')
// import hbHistory from '@/views/User/hbHistory/hbHistory.vue'
const hbHistory = () => import( /* webpackChunkName: "detail_benefit_hbHistory*/ '@/views/User/hbHistory/hbHistory.vue')

// import exchange from '@/views/User/exchange/exchange.vue'
const exchange = () => import( /* webpackChunkName: "exchange_commend_coupon*/ '@/views/User/exchange/exchange.vue')
// import commend from '@/views/User/commend/commend.vue'
const commend = () => import( /* webpackChunkName: "exchange_commend_coupon*/ '@/views/User/commend/commend.vue')
// import coupon from '@/views/User/coupon/coupon.vue'
const coupon = () => import( /* webpackChunkName: "exchange_commend_coupon*/ '@/views/User/coupon/coupon.vue')

// import points from '@/views/User/points/points.vue'
const points = () => import( /* webpackChunkName: "points_detail_notlogin*/ '@/views/User/points/points.vue')
// import detaill from '@/views/User/points/detail/detail.vue'
const detaill = () => import( /* webpackChunkName: "points_detail_notlogin*/ '@/views/User/points/detail/detail.vue')
// import notlogin from '@/views/User/notlogin/notlogin.vue'
const notlogin = () => import( /* webpackChunkName: "points_detail_notlogin*/ '@/views/User/notlogin/notlogin.vue')

// import vipcard from '@/views/User/vipcard/vipcard.vue'
const vipcard = () => import( /* webpackChunkName: "vipcard_payment_invoiceRecord*/ '@/views/User/vipcard/vipcard.vue')
// import payment from '@/views/confirmOrder/payment/payment.vue'
const payment = () => import( /* webpackChunkName: "vipcard_payment_invoiceRecord*/ '@/views/confirmOrder/payment/payment.vue')
// import invoiceRecord from '@/views/User/invoiceRecord/invoiceRecord.vue'
const invoiceRecord = () => import( /* webpackChunkName: "vipcard_payment_invoiceRecord*/ '@/views/User/invoiceRecord/invoiceRecord.vue')

// import useCart from '@/views/User/useCart/useCart.vue'
const useCart = () => import( /* webpackChunkName: "useCart_service_questionDetail*/ '@/views/User/useCart/useCart.vue')
// import service from '@/views/User/service/service.vue'
const service = () => import( /* webpackChunkName: "useCart_service_questionDetail*/ '@/views/User/service/service.vue')
// import questionDetail from '@/views/User/questionDetail/questionDetail.vue'
const questionDetail = () => import( /* webpackChunkName: "useCart_service_questionDetail*/ '@/views/User/questionDetail/questionDetail.vue')

// import hbDescription from '@/views/User/hbDescription/hbDescription.vue'
const hbDescription = () => import( /* webpackChunkName: "hbDescription_vipDescription_download*/ '@/views/User/hbDescription/hbDescription.vue')
// import vipDescription from '@/views/User/vipDescription/vipDescription.vue'
const vipDescription = () => import( /* webpackChunkName: "hbDescription_vipDescription_download*/ '@/views/User/vipDescription/vipDescription.vue')
// import download from '@/views/User/download/download.vue'
const download = () => import( /* webpackChunkName: "hbDescription_vipDescription_download*/ '@/views/User/download/download.vue')

// import orderDetail from '@/views/Order/orderDetail/orderDetail.vue'
const orderDetail = () => import( /* webpackChunkName: "orderDetail_msite_city*/ '@/views/Order/orderDetail/orderDetail.vue')
// import msite from '@/views/Home/msite/msite.vue'
const msite = () => import( /* webpackChunkName: "orderDetail_msite_city*/ '@/views/Home/msite/msite.vue')
// import city from '@/views/Home/city/city.vue'
const city = () => import( /* webpackChunkName: "orderDetail_msite_city*/ '@/views/Home/city/city.vue')

// 2.调用Vue.use()函数，把VueRouter安装为Vue的插件
Vue.use(VueRouter)
//4.制定路由规则
const routes = [{
    path: '/home',
    component: Home
  },
  {
    path: '/msite',
    component: msite
  },
  {
    path: '/forget',
    component: forget
  },
  {
    path: '/user',
    component: User
  },
  {
    path: '/user/info',
    component: info
  },
  {
    path: '/user/info/setusername',
    component: setusername
  },
  {
    path: '/user/info/address',
    component: address
  },
  {
    path: '/user/info/address/add',
    component: add
  },
  {
    path: '/user/info/address/add/addDetail',
    component: addDetail
  },
  {
    path: '/order',
    component: Order
  },
  {
    path: '/order/orderDetail',
    component: orderDetail
  },
  {
    path: '/search',
    component: Serach
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/food',
    component: Food
  },
  {
    path: '/confirmOrder',
    component: confirmOrder
  },
  {
    path: '/confirmOrder/chooseAddress',
    component: chooseAddress
  },
  {
    path: '/confirmOrder/remark',
    component: remark
  },
  {
    path: '/confirmOrder/invoice',
    component: invoice
  },
  {
    path: '/confirmOrder/payment',
    component: payment
  },
  {
    path: '/Details',
    component: Details
  },
  {
    path: '/Details/FoodDetails',
    component: FoodDetails
  },
  {
    path: '/Details/DetailShang',
    component: DetailsShang
  },
  {
    path: '/Details/DetailShang/shopSafe',
    component: shopSafe
  },
  {
    path: '/',
    redirect: '/msite'
  },
  {
    path: '/balance',
    component: balance
  },
  {
    path: '/balance/detail',
    component: detail
  },
  {
    path: '/benefit',
    component: benefit
  },
  {
    path: '/benefit/hbHistory',
    component: hbHistory
  },
  {
    path: '/benefit/exchange',
    component: exchange
  },
  {
    path: '/benefit/commend',
    component: commend
  },
  {
    path: '/benefit/coupon',
    component: coupon
  },
  {
    path: '/benefit/hbDescription',
    component: hbDescription
  },
  {
    path: '/points',
    component: points
  },
  {
    path: '/points/detail',
    component: detaill
  },
  {
    path: '/notlogin',
    component: notlogin
  },
  {
    path: '/vipcard',
    component: vipcard
  },
  {
    path: '/vipcard/invoiceRecord',
    component: invoiceRecord
  },
  {
    path: '/vipcard/useCart',
    component: useCart
  },
  {
    path: '/vipcard/vipDescription',
    component: vipDescription
  },
  {
    path: '/service',
    component: service
  },
  {
    path: '/service/questionDetail',
    component: questionDetail
  },
  {
    path: '/download',
    component: download
  },
  {
    path: '/city/:id',
    component: city
  },
]
// 3.创建路由的实例对象
const router = new VueRouter({
  routes
})
//to 是将要访问的路由的信息对象;
//from 是将要离开的路由的信息对象
//next 是一个函数，调用 next() 表示放行，允许这次路由导航

// 5.向外共享路由的实例对象
export default router